package com.miao.view
{
	import com.miao.utils.Consts;
	
	import flash.events.Event;
	
	import org.puremvc.as3.multicore.patterns.mediator.Mediator;
	
	public class WindowEventMediator extends Mediator
	{
		
		public static const NAME:String = "WindowEventMediator";
		
		public function WindowEventMediator(viewComponent:Object=null)
		{
			super(NAME, viewComponent);
			
			initEvent();
		}
		
		private function initEvent():void{
			player.addEventListener(Event.CLOSING, handleEvt);
		}
		
		private function handleEvt(e:Event):void{
			sendNotification(Consts.WINDOW_EVENT, e.type);
		}
		
		private function get player():StudyPlayer{
			return viewComponent as StudyPlayer;
		}
	}
}